package com.reggie.lotterysystem.dao.mapper;

import com.reggie.lotterysystem.dao.dataobject.WinningRecordDO;
import jakarta.validation.constraints.NotNull;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface WinningRecordMapper {


    void batchInsert(List<WinningRecordDO> winningRecordDOList);

    @Select("select * from winning_record where activity_id = #{activityId}")
    List<WinningRecordDO> selectByActivityId( Long activityId);

    @Select("select count(1) from winning_record where activity_id = #{activityId} and prize_id = #{prizeId}")
    int countByAPId(Long activityId,Long prizeId);

    /**
     * 删除活动/奖品下的中奖记录
     * @param activityId
     * @param prizeId
     */

    void deleteRecords(Long activityId, Long prizeId);

    List<WinningRecordDO> selectByActivityIdOrPrizeId(@NotNull(message = "活动id不能为空") Long activityId, Long prizeId);
}
